package com.blog.mapper;

import com.blog.dto.ExperienceDTO;
import com.blog.entity.Experience;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ExperienceMapper {
    @Select("SELECT * FROM tb_experience WHERE userId = #{currentId}")
    List<Experience> select(@Param("currentId") Long currentId);
    @Select("SELECT * FROM tb_experience WHERE userId = #{currentId} AND title LIKE CONCAT('%',#{value},'%')")
    List<Experience> selectByValue(@Param("currentId") Long currentId,@Param("value")  String value);
    @Select("SELECT * FROM tb_experience WHERE id = #{eId}")
    Experience selectByID(@Param("eId") Long eId);

    @Insert("INSERT INTO tb_experience(title, department, content, startDate, endDate, userId) " +
            "values (#{title},#{department},#{content},#{startDate},#{endDate},#{userId})")
    void insert(Experience experience);

    void update(Experience experience);

    @Delete("delete from tb_experience where id = #{id}")
    void delete(@Param("id") Long id);
}
